package com.tywj.panda.driver.details

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.tywj.lib.core.common.util.ResourcesUtil
import com.tywj.lib.core.common.view.BaseFragment
import com.tywj.lib.route.RouteParam
import com.tywj.panda.customer.common.view.base.MyBaseActivity
import com.tywj.panda.driver.R
import com.tywj.panda.driver.entity.DriverTaskEntity
import com.tywj.panda.driver.route.DriverRoute
import kotlinx.android.synthetic.main.driver_activiry_bus_details.*


/**
 * <pre>
 *     author : June Yang
 *     time   : 2020/06/22
 *     desc   : 班次详情
 *     version: 2.0.0
 * </pre>
 */
@Route(path = DriverRoute.DRIVER_TASK_DETAILS)
class DriverBusDetailsActivity : MyBaseActivity() {


    companion object {
        const val TASK_PASSENGER = "0"
        const val TASK_ROUTE = "1"

        const val PARAMS_TASK_ENTITY = "task_bean"
    }

    private var id = ""

    private var taskEntity: DriverTaskEntity.DataBean? = null


    //我的订单记录类型页面集合
    private val fragmentList = ArrayList<BaseFragment>()

    //我的订单记录类型标题数组
    private val titleArray = arrayOfNulls<String>(2)


    override fun getLayoutID(): Int = R.layout.driver_activiry_bus_details

    override fun initVariable(savedInstanceState: Bundle?) {
        super.initVariable(savedInstanceState)

        taskEntity = RouteParam(this).getParcelable(PARAMS_TASK_ENTITY)

        titleArray[0] = ResourcesUtil.getString(R.string.driver_passenger_info)
        titleArray[1] = ResourcesUtil.getString(R.string.driver_driver_line)

        fragmentList.add(DriverRoute.getDriverPassengerFragment(this, taskEntity!!))
        fragmentList.add(DriverRoute.getDriverRouteFragment(this, taskEntity!!))

    }

    @Suppress("UNCHECKED_CAST")
    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)

        slidingTabLayoutDetails.setViewPager(
            taskDetailsViewPager,
            titleArray,
            this,
            fragmentList as ArrayList<Fragment>
        )
    }
}